package com.ruoyi.project.jiaqin.wanttobuycollect.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.wanttobuycollect.domain.WantToBuyCollect;
import com.ruoyi.project.jiaqin.wanttobuycollect.mapper.WantToBuyCollectMapper;
import com.ruoyi.project.jiaqin.wanttobuycollect.service.IWantToBuyCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 求购收藏Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-22
 */
@Service
public class WantToBuyCollectServiceImpl implements IWantToBuyCollectService 
{
    @Autowired
    private WantToBuyCollectMapper wantToBuyCollectMapper;

    /**
     * 查询求购收藏
     * 
     * @param id 求购收藏ID
     * @return 求购收藏
     */
    @Override
    public WantToBuyCollect selectWantToBuyCollectById(String id)
    {
        return wantToBuyCollectMapper.selectWantToBuyCollectById(id);
    }

    /**
     * 查询求购收藏列表
     * 
     * @param wantToBuyCollect 求购收藏
     * @return 求购收藏
     */
    @Override
    public List<WantToBuyCollect> selectWantToBuyCollectList(WantToBuyCollect wantToBuyCollect)
    {
        return wantToBuyCollectMapper.selectWantToBuyCollectList(wantToBuyCollect);
    }

    /**
     * 新增求购收藏
     * 
     * @param wantToBuyCollect 求购收藏
     * @return 结果
     */
    @Override
    public int insertWantToBuyCollect(WantToBuyCollect wantToBuyCollect)
    {
        wantToBuyCollect.setId(UUID.randomUUID().toString().replace("-",""));
        return wantToBuyCollectMapper.insertWantToBuyCollect(wantToBuyCollect);
    }

    /**
     * 修改求购收藏
     * 
     * @param wantToBuyCollect 求购收藏
     * @return 结果
     */
    @Override
    public int updateWantToBuyCollect(WantToBuyCollect wantToBuyCollect)
    {
        return wantToBuyCollectMapper.updateWantToBuyCollect(wantToBuyCollect);
    }

    /**
     * 删除求购收藏对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWantToBuyCollectByIds(String ids)
    {
        return wantToBuyCollectMapper.deleteWantToBuyCollectByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除求购收藏信息
     * 
     * @param id 求购收藏ID
     * @return 结果
     */
    @Override
    public int deleteWantToBuyCollectById(String id)
    {
        return wantToBuyCollectMapper.deleteWantToBuyCollectById(id);
    }

    @Override
    public WantToBuyCollect selectBuyCollectByMemberIdAndToWantToBuyId(String memberId, String toWantToBuyId) {
        return wantToBuyCollectMapper.selectBuyCollectByMemberIdAndToWantToBuyId(memberId, toWantToBuyId);
    }
}
